 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>代付流水查询</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link href="<s:url value="/css/a.css"/>" type="text/css"
	rel="stylesheet" />
<link href="<s:url value="/css/index.css"/>" type="text/css"

	rel="stylesheet" />
	 <link rel="stylesheet" href="<s:url value="/css/common.css"/>"/>
<script type="text/javascript"
	src="<s:url value="/js/jquery-1.9.1.min.js" />"></script>
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>

<style>
　　　
a{
	text-decoration: none
}

a:link{
text-decoration:none;
}
a:visited{
text-decoration:none;
}
a:hover{
text-decoration:none;
}
a:active{
text-decoration:none;
}
　　


　　　
</style>

<script type="text/javascript">
	 	function   str2date(str){   
			  var   d=null;   
			  var   reg=/^(\d{4})(\d{2})(\d{2})$/  ;
			  if(arr=str.match(reg))d=new   Date(Number(arr[1]),Number(arr[2])-1,Number(arr[3])) ; 
			  return   d;   
			  }
			  
			 function subForm() {
				
				
				var beginTime = $("#minDate").val();
				/* if(beginTime==null || beginTime==""){
					alert("请选择代付日期!");
					return false;
				} */
				//$("#maxDate").val(beginTime);
				var endTime = $("#maxDate").val();
				if (!endTime || !beginTime) {
					alert("起始时间范围必须选择!");
					return false;
				}
				var date1 = str2date(beginTime);
				var date2 = str2date(endTime);
		
				if (date1.getMonth() != date2.getMonth()) {
					alert("选择的起始时间不在同一个月内！");
					return false;
				} 
				return true;
			} 

$(document).ready(function() {
	$("#szPower").click(function() {
				var mid=$("#merNo").val();
				mid=trim(mid);
				if(mid===""){ alert("请输入商户号！"); return;}
				
				var start=$("#minDate").val();if(start==""){ alert("请选择交易起始日期！");return;}
				var end =$("#maxDate").val();if(end=="") {alert("请选择交易截止日期！");return;}
				
				var date1 = str2date(start);
				var date2 = str2date(end);
		
				if (date1.getMonth() != date2.getMonth()) {
					alert("选择的起始时间不在同一个月内！");
					return false;
				}
				
				if(mid.length>0 && start.length>0){
					
					$("#queryNegotiationForm").attr("action","<%=basePath%>/excel/negotiationExcel.ct");
					$("#queryNegotiationForm").submit();
				
				} 
		});
		
		$("#subForm").click(function(){
			var  is= subForm();  
    		 if(is){
    			 $("#subForm").attr("disableed",true);
    			queryForms();
    		 }
		});
			
});

	function trim(str){   
    str = str.replace(/^(\s|\u00A0)+/,'');   
    for(var i=str.length-1; i>=0; i--){   
        if(/\S/.test(str.charAt(i))){   
            str = str.substring(0, i+1);   
            break;   
        }   
    }   
    return str;   
}  
	function queryForms(){
		
			$("#queryNegotiationForm").attr("action","<%=basePath%>/negotiation/queryNegotiationForm.ct");
			$("#queryNegotiationForm").submit();
	}		
</script>



</head>

<body>

	<div class="subpage">
		<s:form id="queryNegotiationForm" action="/negotiation/queryNegotiation.ct" method="post" theme="simple">
<table class="tb">
    <tbody>
        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h2">POS收单运营管理平台</div></td>
        </tr>

        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h3">代付流水查询</div></td>
        </tr>

        <tr class="tb-line">
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">代付日期：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-mini">
                <input id="minDate"  value="<c:if test='${searchCondition.minDate !=null }'>${searchCondition.minDate }</c:if>" 
                		name="searchCondition.minDate" type="text"  onfocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"/>
                		</label>-<label class="tb-input-mini"><s:textfield id="maxDate"  name="searchCondition.maxDate" 
                onfocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
                /></label><code class="asterisk">*</code>
            </td>
            <td align="right" class="tb-td">
            	 <div class="tb-h4">交易金额范围：</div>
            </td>
             <td class="tb-td">
             <label class="tb-input-normal" style="width:120px;">
             		<s:textfield id="minRMB" name="searchCondition.minRMB"  cssStyle="width:100px;"/>
					&nbsp;&nbsp;-
             </label>
			 <label class="tb-input-normal" style="width:120px;">
					<s:textfield id="maxRMB" name="searchCondition.maxRMB"  cssStyle="width:100px;"/>&nbsp;&nbsp;元
             </label>
              </td>
            
        </tr>
	
        <tr class="tb-line">
            
            <td align="right" class="tb-td">
                <div class="tb-h4">商户号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal"> 
             <s:if test="#session.session_merchant.roleType==\"15\"">
                <s:textfield id="merNo" name="searchCondition.merNo"  readonly="true" value="%{#session.session_merchant.accountNo}" cssClass="queryWidth" />
            </s:if><s:else>
                <s:textfield id="merNo" name="searchCondition.merNo" cssClass="queryWidth" />
            </s:else>
                </label>
            </td>
            
            <td align="right" class="tb-td">
                <div class="tb-h4">结算账号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                <s:textfield id="searchCondition.account" name="searchCondition.account" cssClass="queryWidth" />
                </label>
            </td>
        </tr>
	
		
        <tr class="tb-line">
            
            <td align="right" class="tb-td">
                <div class="tb-h4">商户名称：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield id="merName" name="searchCondition.merName" cssClass="queryWidth" />
                </label>
            </td>
            <td align="right" class="tb-td">
                <div class="tb-h4">状态：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
               	<s:select id="searchCondition.reversal" name="searchCondition.reversal" cssClass="queryWidth" list="#{'99':'--请选择--','0':'代付交易成功','1':'代付交易失败'}"></s:select>
                </label>
            </td>
        </tr>

        <tr class="tb-line">
            <td class="tb-td line-submit" align="right" colspan="4">
                <label class="tb-input-submit">
                    <input  id="subForm" value="查   询" type="button" />
                </label>
                <label class="tb-input-submit">
                    <s:reset value="取  消" />
                </label>
               <label class="tb-input-submit">
                
				
                                
                	<s:if  test="#request.searchRsList != null && #request.searchRsList.size>0">
						<input id="szPower" type="button" value="代付流水Excel" />
					   
					</s:if>
					<s:else>
					 	<input id="szPower" disabled="disabled" value="代付流水Excel" type="button" />
					</s:else>
					
                </label>
            </td>
        </tr>
        
    </tbody>
</table>
			
		
<div class="big-tb">
    <table class="tb" style="width: 120%;">
        <thead>
       		 <%-- <tr class="tb-line">
				<td colspan="12" align="center"><span style="font-color: red"><s:actionerror /></span>
					<span style="font-color: red;"><s:actionmessage /></span > <span style="font-color: red;"><s:fielderror /></span>
					<span id="otherError"></span>
				</td>
			</tr>	 --%>
            <tr class="tb-line">
                <th class="tb-th" colspan="15">代付流水</th>
            </tr>
            <s:if	test="#request.searchRsList != null && #request.searchRsList.size>0">
			<tr class="tb-line">
				<td class="tb-td paging"  align="left" colspan="14">
				<page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/negotiation/queryNegotiationForm.ct?currentPage=" />

				</td>
			</tr>
			</s:if>
            <tr class="tb-line bg-gray">
           	 	<th class="tb-th">代付日期</th>
				<th class="tb-th">交易时间</th>
				<th class="tb-th">处理状态</th>
				<th class="tb-th">交易流水号</th>
				<th class="tb-th">商户代码</th>
				<th class="tb-th">商户名称</th>
				<th class="tb-th">收款行名称</th>
				<th class="tb-th">收款人账号</th>
				<th class="tb-th">收款人名称</th>
				<!-- <th class="tb-th">付款人账号</th>
				<th class="tb-th">付款人名称</th> -->
				<th class="tb-th">付款金额（元）</th>
<!-- 				<th class="tb-th">手续费（元）</th>
				<th class="tb-th">结算金额（元）</th> -->
               
            </tr>
        </thead>
        <tbody>
        <s:iterator value="#request.negotiationList" status="stat" id="nego">
					<tr  class="tb-line" >
			            <td class="tb-td">
						<s:property value="#nego.TransDt"/>
						</td>
						<td class="tb-td">
						<s:property value="#nego.TransTm"/>
						</td>
						<td class="tb-td"> 
					<s:if test='#nego.RespCd=="00"'>代付成功</s:if>
					<s:elseif test='#nego.RespCd=="G9"'>代付成功</s:elseif>
					 <s:else>代付失败</s:else>  		
						</td>
						<td class="tb-td">
						<s:property value="#nego.TranSeq"/>
						</td>
						<td class="tb-td">
						<s:property value="#nego.MchntCd"/>
						</td>
						<td class="tb-td">
						<s:property value="#nego.MchntNm"/>
						</td>
						<td class="tb-td">
						<s:property value="#nego.PyeBankNm"/>
						</td>
						<td class="tb-td">
						<s:property value="#nego.PyeAcctNo"/>
						</td>
						<td class="tb-td">
						<s:property value="#nego.PyeAcctNm"/>
						</td>
						<%-- <td>
						<s:property value="#nego.PriBankNm"/>
						</td> --%>
					<%-- 	<td class="tb-td">
						<s:property value="#nego.PriAcctNo"/>
						</td>
						<td class="tb-td">
						<s:property value="#nego.PriAcctNm"/>
						</td> --%>
						<td class="tb-td">
						<s:property value="#nego.TranAmt/100"/>
						</td>
				<%-- 		<td class="tb-td">
						<s:property value="#nego.StlmFee/100"/>
						</td>
						<td class="tb-td">
						<s:property value="#nego.StlmAmt/100"/>
						</td> --%>
				    </tr>
			     </s:iterator>
			
        </tbody>
    </table>
</div>	
	    	
		</s:form>
	</div>
	<s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>
